﻿Imports System
Imports System.Configuration

Namespace System.Workflow.Runtime.Configuration
    Public Class WorkflowRuntimeSection
        Inherits ConfigurationSection
        ' Properties
        <ConfigurationProperty("CommonParameters", DefaultValue:=Nothing)> _
        Public ReadOnly Property CommonParameters As NameValueConfigurationCollection
            Get
                Return DirectCast(MyBase.Item("CommonParameters"), NameValueConfigurationCollection)
            End Get
        End Property

        <ConfigurationProperty("EnablePerformanceCounters", DefaultValue:=True)> _
        Public Property EnablePerformanceCounters As Boolean
            Get
                Return CBool(MyBase.Item("EnablePerformanceCounters"))
            End Get
            Set(ByVal value As Boolean)
                MyBase.Item("EnablePerformanceCounters") = value
            End Set
        End Property

        <ConfigurationProperty("Name", DefaultValue:="")> _
        Public Property Name As String
            Get
                Return CStr(MyBase.Item("Name"))
            End Get
            Set(ByVal value As String)
                MyBase.Item("Name") = value
            End Set
        End Property

        <ConfigurationProperty("Services", DefaultValue:=Nothing)> _
        Public ReadOnly Property Services As WorkflowRuntimeServiceElementCollection
            Get
                Return DirectCast(MyBase.Item("Services"), WorkflowRuntimeServiceElementCollection)
            End Get
        End Property

        <ConfigurationProperty("ValidateOnCreate", DefaultValue:=True)> _
        Public Property ValidateOnCreate As Boolean
            Get
                Return CBool(MyBase.Item("ValidateOnCreate"))
            End Get
            Set(ByVal value As Boolean)
                MyBase.Item("ValidateOnCreate") = value
            End Set
        End Property


        ' Fields
        Private Const _enablePerfCounters As String = "EnablePerformanceCounters"
        Private Const _name As String = "Name"
        Private Const _services As String = "Services"
        Private Const _validateOnCreate As String = "ValidateOnCreate"
        Private Const commonParametersSectionName As String = "CommonParameters"
        Friend Const DefaultSectionName As String = "WorkflowRuntime"
    End Class
End Namespace

